import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
import { GameManager, GameStatus } from './GameManager';

@ccclass('MovePipe')
export class MovePipe extends Component {
  start() {

  }

  update(deltaTime: number) {
    if (GameManager.status === GameStatus.GamePlay) {
      const MoveDistance = GameManager.MoveSpeed * deltaTime
      this.node.setPosition(this.node.position.x - MoveDistance, this.node.position.y)
      if (this.node.position.x <= -900) {
        this.node.destroy()
      }
    }
  }
}


